-module(link_test).
-compile(export_all).

start() ->
    spawn_link(fun() -> func() end),
    ok.

func() ->
    %process_flag(trap_exit, true),
    Pid = spawn(fun() -> quit() end),   % not exist process
    timer:sleep(1000),
    Ret = link(Pid),
    io:format("link ~p~n", [Ret]),
    receive
        {'EXIT', Pid, Why} ->
            io:format("receive exit from ~p for ~p~n", [Pid, Why])
    end.

quit() ->
    io:format("~p quit now~n", [self()]).
